package com.sun;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegularTeat2Greed {
    public static void main(String[] args) {
//        Pattern pattern = Pattern.compile("^(\\d+)(0*)$");
        //使用？实现非贪婪匹配
        //?还可以用来表示匹配0个或者1个 \dd?表示匹配0个
        Pattern pattern = Pattern.compile("^(\\d+?)(0*)$");
        Matcher matcher = pattern.matcher("12300000");
        if(matcher.matches()){
            System.out.println(matcher.group(0));
            System.out.println(matcher.group(1));
            System.out.println(matcher.group(2));
        }
    }

}
